<%--
  Created by IntelliJ IDEA.
  User: gaoran
  Date: 2020/7/16
  Time: 11:05
  To change this template use File | Settings | File Templates.
--%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html style="width: 100%;overflow-x: auto;position:relative ">
<head>
    <title>评测对象详情</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">

    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link type="text/css" rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">

    <script src="/js/common/language.js"></script>

    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/pagination/js/jquery.pagination.min.js"></script>

    <%--<script src="/js/document/makeADraft.js"></script>--%>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style>

        table tr {
            border-width: 1px;
            border-style: solid;
            border-color: rgb(204, 204, 204);
            border-image: initial;
        }
        table tr th {
            font-size: 13pt;
            color: rgb(47, 92, 143);
            text-align: center;
            padding: 6px;
        }

        table  td {
            font-size: 11pt;
            padding: 6px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            word-break: keep-all;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
        table tr:nth-child(2n) {
            background-color: rgb(255, 255, 255);
        }
        table tr:nth-child(2n+1) {
            background-color:#F6F7F9 ;
        }
        .newLeave {
            border-radius: 3px;
            margin-right: 3%;
            float: right;
            width: 70px;
            height: 28px;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            margin-right: 3%;
            margin-top: 14px;
            cursor: pointer;
            background: #2b7fe0
        }
        .clearfix {
            margin: 5px auto;
            width: 93%;
        }
        textarea.BigStatic {
            font-size: 10pt;
            padding: 1px 5px;
            border: 1px solid #C0BBB4;
            background: #E0E0E0;
            height: 26px;
            border-radius:5px;
            width: 125px;
            /*margin-left: 32px;*/
        }
        .index-desc{
            height: 95px;
            float: left;
            line-height: 95px;
            margin-right: 9px;
        }
        .lab-set{
            height: 50px;
            float: left;
            line-height: 47px;

        }
        #portalName{
            height: 30px;
            margin-right: 16px;
        }
        .li-set p{
            margin: 5px 0 0 103px;
        }
        .M-box3 .active {
            margin: 0px 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color: #fff;
            text-align: center;
            display: inline-block;
        }
        .M-box3 {
            margin-top: 30px;
            position: fixed;
            bottom: 10px;
            right: 76px;
            text-align: center;
        }
        .M-box3 a {
            margin: 0 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            font-size: 12px;
            display: inline-block;
            text-align: center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #333;
            text-decoration: none;
        }
        .jump-ipt {
            width: 38px;
            height: 38px;
            line-height: 38px;
            text-align: center;
            padding: 0;
        }
        .main{
            margin-top: 40px;
            margin-left: 44px;
            height:60px;
        }
        .main ul{
            height:40px;
            margin-top: 5px;
        }
        .main li{
            margin-right: 4%;
            float: left;
        }
        .main .leftspan{
            vertical-align: middle;
        }
        .main a{
            margin: 2px;
            color: #007cfd;
            position: relative;
            top:-12px;
        }
        #kaoheBiaoji{
            margin-left: 12px;
        }
        select {
            margin-left: 12px;
            width: 139px;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 4px;
            padding-left: 6px;
        }
        input {
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 5px;
            padding-left: 6px;
        }
        #u518_input {
            width: 70px;
            height: 27px;
            font-family: 'Arial Normal', 'Arial';
            /* font-weight: 400; */
            font-style: normal;
            font-size: 13px;
            /* text-decoration: none; */
            color: #fff;
            /* text-align: center; */
            background: #2b7edf url(../../img/kaohesousuo.png) no-repeat 10px 8px;
            border: none;
            padding-left: 20px;
            border-radius: 4px;
        }
        .del{
            color: #e01919;
        }
        .main .orgClear{
            color: #e01919;
        }
        #newMain  .leftspan{
            display: inline-block;
            width: 156px;
            text-align: right;
            margin-right: 52px;
            vertical-align: top;
        }
        #newMain input{
            width: 250px;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 2px;
            padding-left: 6px;
        }
        #newMain li{
            list-style: none;
            margin:12px 0;
            padding: 0;
        }
        #newMain .inputsmall{
            width: 116px;
            height: 30px;
            text-align: center;
            padding-left: 0px;
        }
        #newMain select {
            width: 258px;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 2px;
            padding-left: 6px;
            margin-left: 0;
        }
        #newMain .mustinput{
            color: red;
            height: 26px;
            line-height: 32px;
            margin-left: 5px;
        }
        #newMain .btn{
            color: #2e8ded;
        }
        #newMain .clear{
            color: #e01919;
        }
        #newMain .clear3{
            color: #e01919;
        }
        #newMain .clear4{
            color: #e01919;
        }
        #newMain .adddept:hover{
            cursor:pointer;
        }
        #newMain .clear:hover{
            cursor:pointer;
        }
        .head-top {
            width: 100%;
            position: fixed;
            top: 0px;
            left: 0px;
            height: 45px;
            border-bottom: 1px solid #999;
            background: #fff;
            overflow: hidden;
            z-index: 9999999;
        }
        .head-top ul .head-top-li {
            height: 26px;
            line-height: 26px;
            margin: 6px 11px 0px 11px;
            padding: 1px 20px;
            font-size: 14px;
            border-radius: 20px;
            cursor: pointer;
        }
        .navigation {
            width: 100%;
            box-sizing: border-box;
            height: 70px;
            padding-left: 34px;
            line-height: 70px;
        }
        .navigation img {
            vertical-align: middle;
        }
        .navigation h2 {
            font-weight: normal;
            display: inline-block;
            font-size: 22px;
            color: #494d59;
            vertical-align: middle;
            margin-left: 10px;
        }
        .newClass{
            float: right;
            width: 90px;
            height: 28px;
            background: url(../../img/file/cabinet01.png) no-repeat;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            margin: 2%  3% 0 0;
            cursor: pointer;
        }
        /*.two td  th*/
        /*{*/
            /*border:1px solid black;*/
        /*}*/
        /*.two th*/
        /*{*/
            /*background-color:green;*/
            /*color:white;*/
        /*}*/
        .two table th,.two table tr,.two table tr td{
            border:1px solid grey;
        }
        .morebutton{
            width: 38px;
            height: 22px;
            border-radius: 3px;
            border: 1px solid gray;
            background-color: #ffffff;
        }
        .back{
            border-color: #4898d5;
            background-color: #2e8ded;
            color: #fff;
            padding: 5px 15px;
            text-align: center;
        }

    </style>
</head>
<body>
<div class="navigation">
    <img src="/img/kaoheguanli.png" alt="">
    <h2>评测方案管理-评测对象详情</h2>
    <h3 style="margin-top: -46px;font-size: 14px;">评测对象：</h3>
    <%--<div class="newClass" id="newClass">--%>
    <%--<span style="margin-left: 30px;">--%>
    <%--<img style="margin-right: 4px;margin-left: -11px;margin-bottom: 2px;" src="../../img/mywork/newbuildworjk.png" alt="">--%>
    <%--新建--%>
    <%--</span>--%>
    <%--</div>--%>
</div>
<table style="margin:42px auto;width:95%;" >
    <thead>
    <tr style="background: none">
        <th style="width:12%">姓名</th>
        <th style="width:12%">部门</th>
        <th style="width:12%">职位 </th>
    </tr>
    </thead>
    <tbody id="taskBody">
    </tbody>
</table>
<h3 style="margin-top: -36px;margin-left: 33px;font-size: 14px;">评测对象的参评人员列表：</h3>
<div class="two">
    <table style="margin:0 auto;width:95%;">
        <thead>
        <tr>
            <th>角色</th>
            <th>权重</th>
            <th>姓名</th>
            <th>人员权重</th>
        </tr>
        </thead>
        <tbody id="taskBody1">
        </tbody>
        <%--<tr>--%>
        <%--<td>上级</td>--%>
        <%--<td>平级</td>--%>
        <%--<td>下级</td>--%>
        <%--<td>$100</td>--%>
        <%--</tr>--%>
    </table>
</div>
<div style="margin:20px auto;text-align: center;"><button class="back">返回</button></div>
<div id="dbgz_page" class="M-box3" style="display: none">
</div>
<script>
    function getQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }
    var userId =getQueryString("userId");
    var flowId = getQueryString("flowId");
    //列表带分页
    function undefindData(data) {
        if(data == undefined){
            return '';
        }else{
            return data;
        }
    }

    var ajaxPageTr={
        data:{
            userId:userId
        },
        page:function () {
            var me=this;
            layer.msg('加载中', {
                icon: 16
                ,shade: 0.01
            });
            $.ajax({
                type:'get',
                url:'/user/findUserByuserId',
                dataType:'json',
                data:me.data,
                success:function(res){
                    if(res){
                        var str='';
                        $.each(res.object, function (index, item) {
                            str = '<tr userId="'+item.userId+'">' +
                                '<td title="'+undefindData(res.object.userName) +'">' + undefindData(res.object.userName) + '</td>' +
                                '<td title="'+undefindData(res.object.deptName)+'">' + undefindData(res.object.deptName)+ '</td>' +
                                '<td title="'+undefindData(res.object.userPrivName)+'">' + undefindData(res.object.userPrivName)+ '</td>' +
                                '</tr>';

                        })
                        $('#taskBody').html(str)
                        layer.closeAll();
                        me.pageTwo(res.totle,me.data.pageSize,me.data.page)
                    }else{
                        layer.msg("暂无数据", {icon: 2})
                    }

                }
            })

            $.ajax({
                type:'get',
                url:'/scoreFlowUser/selAssessors',
                dataType:'json',
                data:{
                    scoreFlowId:flowId,
                    userId:userId
                },
                success:function(res){
                    if(res){
                        var str='';
                        var privUsers1 = res.data.privUsers1;
                        var privUsers2 = res.data.privUsers2;
                        var privUsers3 = res.data.privUsers3;

                        // 遍历上级
                        for(var i=0,length=privUsers1.length;i<length;i++){
                            var privUser = privUsers1[i];
                            if(i==0){
                                str+='<tr>' +
                                    '<td rowspan="'+length+'">上级</td><td rowspan="'+length+'">'+Math.round(privUser.privWeight*10000)/100+'%</td><td>'+privUser.assessorName+'</td><td>'+Math.round(privUser.assessorWeight*10000)/100+'%</td>'+
                                    '</tr>'
                            } else {
                                str+='<tr>' +
                                    '<td>'+privUser.assessorName+'</td><td>'+Math.round(privUser.assessorWeight*10000)/100+'%</td>'+
                                    '</tr>'
                            }

                        }

                        // 遍历平级
                        for(var i=0,length=privUsers2.length;i<length;i++){
                            var privUser = privUsers2[i];
                            if(i==0){
                                str+='<tr>' +
                                    '<td rowspan="'+length+'">平级</td><td rowspan="'+length+'">'+Math.round(privUser.privWeight*10000)/100+'%</td><td>'+privUser.assessorName+'</td><td>'+Math.round(privUser.assessorWeight*10000)/100+'%</td>'+
                                    '</tr>'
                            } else {
                                str+='<tr>' +
                                    '<td>'+privUser.assessorName+'</td><td>'+Math.round(privUser.assessorWeight*10000)/100+'%</td>'+
                                    '</tr>'
                            }
                        }

                        // 遍历下级
                        for(var i=0,length=privUsers3.length;i<length;i++){
                            var privUser = privUsers3[i];
                            if(i==0){
                                str+='<tr>' +
                                    '<td rowspan="'+length+'">下级</td><td rowspan="'+length+'">'+Math.round(privUser.privWeight*10000)/100+'%</td><td>'+privUser.assessorName+'</td><td>'+Math.round(privUser.assessorWeight*10000)/100+'%</td>'+
                                    '</tr>'
                            } else {
                                str+='<tr>' +
                                    '<td>'+privUser.assessorName+'</td><td>'+Math.round(privUser.assessorWeight*10000)/100+'%</td>'+
                                    '</tr>'
                            }
                        }


                        $('#taskBody1').html(str);
                        layer.closeAll();
                    }else{
                        layer.msg("暂无数据", {icon: 2})
                    }

                }
            })
        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                prevContent:'上一页',
                nextContent:'下一页',
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {
                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    ajaxPageTr.page();
    //返回
    $('.back').click(function () {
        location.href="/scoreFlowUser/userList?flowId="+flowId
    })
</script>

</body>
</html>

